
import static org.junit.Assert.*;
import org.junit.*;
import org.junit.Test;

import com.thoughtworks.selenium.*;
public class TargetTest
{
	public Selenium bo = new DefaultSelenium("localHost",4444,"*firefox","http://www.target.com/");
	String homepagetitle="Target.com : Furniture, Baby, Electronics, Toys,...: Target";
	
	String elepriceinlist="//ul[@class='productsListView']/li/div[3]/span";
	
	@Test
	public void testTargetHome()
	{
		bo.start();
		bo.open("/");
		bo.windowMaximize();
		assertEquals(homepagetitle,bo.getTitle());
		bo.mouseOver("link=kids");
		bo.highlight("link=umbrellas");
		
		/*
		bo.click("link=umbrellas");
		bo.waitForPageToLoad("30000");
		*/
		clickAndWait("link=umbrellas");
		String priceinlist=bo.getText(elepriceinlist);
		
		/*
		bo.click("link=Futai Clear Bubble Umbrella with Purple Trim");
		bo.waitForPageToLoad("30000");
		*/
		clickAndWait("link=Futai Clear Bubble Umbrella with Purple Trim");
		
		String  priceindetails=bo.getText("//div[@id='price_main']/p");
		assertEquals(priceinlist, priceindetails);
		bo.close();
		
	}
	
	public void clickAndWait(String element)
	{
	bo.click(element);
	bo.waitForPageToLoad("300000");
	}

	public void clickAndWait(String element, String milsec)
	{
	bo.click(element);
	bo.waitForPageToLoad(milsec);
	}
}
